package tijava.container.type;

/**
 * 一个可比较的对象，只实现了Comparable接口<br>
 * 对于TreeSet来说，只实现了Comparable接口，不需要重写equals和hashCode方法
 * 
 * @author nathan
 * 
 */
public class ComparableType extends BasicType implements Comparable<BasicType> {
	public ComparableType() {
		super();
	}

	public ComparableType(char primary, int secondary, String item) {
		super(primary, secondary, item);
	}

	/**
	 * primary为主比较值、secondary为辅比较值
	 */
	@Override
	public int compareTo(BasicType o) {
		if (this.primary > o.primary)
			return +1;
		if (this.primary == o.primary) {
			if (this.secondary > o.secondary)
				return +1;
			else if (this.secondary == o.secondary)
				return 0;
		}
		return -1;
	}

}
